<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>for语句</title>
    <script>

       //1 ~ 100 求和  5050
        var sum = 0;
        for (var i = 1; i <= 100; i ++){
            sum += i;
        }
        alert(sum);

    </script>
</head>
<body>

</body>
</html>